package com.yiren.backstage.currency.entity;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Transient;

import com.yiren.backstage.db.dao.DaoSession;
import com.yiren.backstage.db.dao.GradeStandardEntityDao;
import com.yiren.backstage.db.dao.SingleLightEntityDao;

/**
 * Time:2021/11/09 10:56
 * Author:xiaozan
 * Description:单项灯光 bean
 */
@Entity(nameInDb = "single_light", createInDb = false)
public  class SingleLightEntity implements Parcelable ,Cloneable{


    private static final long serialVersionUID = -2471228422560467196L;

    @Id
    private String id;

    /**等待完成时间*/
    private int waitTime;

    /**灯光内容*/
    private String content;

    /**
     * 1,封装信号
     * 2，自定义
     */
    private String stateType;

    /**监控状态值 保存Map<CarStateNameEnum,Object>的json*/
    private String stateValue;

    @Transient
    private String stateValueShow;

    /**扣分ID*/
    private String gradeStandardId;
    @ToOne(joinProperty = "gradeStandardId")
    private GradeStandardEntity gradeStandardEntity;


    @Override
    public Object clone() throws CloneNotSupportedException {
        // TODO Auto-generated method stub
        return super.clone();
    }

    protected SingleLightEntity(Parcel in) {
        id = in.readString();
        waitTime = in.readInt();
        content = in.readString();
        stateType = in.readString();
        stateValue = in.readString();
        stateValueShow = in.readString();
        gradeStandardId = in.readString();
    }

    @Generated(hash = 2125983756)
    public SingleLightEntity(String id, int waitTime, String content, String stateType,
            String stateValue, String gradeStandardId) {
        this.id = id;
        this.waitTime = waitTime;
        this.content = content;
        this.stateType = stateType;
        this.stateValue = stateValue;
        this.gradeStandardId = gradeStandardId;
    }

    @Generated(hash = 1499734007)
    public SingleLightEntity() {
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeInt(waitTime);
        dest.writeString(content);
        dest.writeString(stateType);
        dest.writeString(stateValue);
        dest.writeString(stateValueShow);
        dest.writeString(gradeStandardId);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getWaitTime() {
        return this.waitTime;
    }

    public void setWaitTime(int waitTime) {
        this.waitTime = waitTime;
    }

    public String getContent() {
        return this.content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getStateType() {
        return this.stateType;
    }

    public void setStateType(String stateType) {
        this.stateType = stateType;
    }

    public String getStateValue() {
        return this.stateValue;
    }

    public void setStateValue(String stateValue) {
        this.stateValue = stateValue;
    }

    public String getGradeStandardId() {
        return this.gradeStandardId;
    }

    public void setGradeStandardId(String gradeStandardId) {
        this.gradeStandardId = gradeStandardId;
    }

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1389097317)
    public GradeStandardEntity getGradeStandardEntity() {
        String __key = this.gradeStandardId;
        if (gradeStandardEntity__resolvedKey == null || gradeStandardEntity__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            GradeStandardEntityDao targetDao = daoSession.getGradeStandardEntityDao();
            GradeStandardEntity gradeStandardEntityNew = targetDao.load(__key);
            synchronized (this) {
                gradeStandardEntity = gradeStandardEntityNew;
                gradeStandardEntity__resolvedKey = __key;
            }
        }
        return gradeStandardEntity;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 695994375)
    public void setGradeStandardEntity(GradeStandardEntity gradeStandardEntity) {
        synchronized (this) {
            this.gradeStandardEntity = gradeStandardEntity;
            gradeStandardId = gradeStandardEntity == null ? null : gradeStandardEntity.getId();
            gradeStandardEntity__resolvedKey = gradeStandardId;
        }
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 720919158)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getSingleLightEntityDao() : null;
    }

    public static final Creator<SingleLightEntity> CREATOR = new Creator<SingleLightEntity>() {
        @Override
        public SingleLightEntity createFromParcel(Parcel in) {
            return new SingleLightEntity(in);
        }

        @Override
        public SingleLightEntity[] newArray(int size) {
            return new SingleLightEntity[size];
        }
    };

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 879389219)
    private transient SingleLightEntityDao myDao;

    @Generated(hash = 107543780)
    private transient String gradeStandardEntity__resolvedKey;

    public String getStateValueShow() {
        return stateValueShow;
    }

    public void setStateValueShow(String stateValueShow) {
        this.stateValueShow = stateValueShow;
    }
}
